package com.example.eurekaserver2.controller;

import com.example.eurekaserver2.feign.FeignService;
import com.example.eurekaserver2.service.ClassServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author chenxiaomeng
 */
@RestController
public class ClassController {

    private final ClassServiceImpl classService;
    private final FeignService feignService;

    @Autowired
    public ClassController(ClassServiceImpl classService, FeignService feignService) {
        this.classService = classService;
        this.feignService = feignService;
    }

    @RequestMapping("/feignTest")
    public Object feignTest(){
        return feignService.getFeign();
    }


    @RequestMapping("/updateClass")
    public Object updateClass(@RequestBody Map<String, Integer> map){
        return classService.update(map.get("count"));
    }
}
